home *** CD-ROM | disk | FTP | other *** search
- Path: uni-erlangen.de!winx03!news
- From: Volker Braun <vrbraun@cip.physik.uni-wuerzburg.de>
- Newsgroups: comp.lang.c++
- Subject: Re: void pointers
- Date: Wed, 10 Jan 1996 09:08:42 +0100
- Organization: University of Wuerzburg, Germany
- Message-ID: <30F3740A.A06@cip.physik.uni-wuerzburg.de>
- References: <Pine.SUN.3.91.960105113409.18158A-100000@phoenix.acms.arizona.edu> <DKx55F.1D4@news.zippo.com>
- NNTP-Posting-Host: wpax11.physik.uni-wuerzburg.de
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0b4 (X11; I; HP-UX A.09.01 9000/705)
-
- Jim McFarland wrote:
- >
- > Kenton White <jwhite@phoenix.acms.arizona.edu> wrote:
- > >
- > >
- > >I am trying to create a class that stores pointers to other classes in an
- > >array of void pointers. Since void pointers cannot be dereferenced, is
- > >there any way to cast the void pointer to a non-void pointer and then
- > >dereference?
- > >
- >
- > Since you are trying to create a container class, what you need to do is
- > to use polmorphism and avoid using void pointers all together.
-
- You schould think about using templates for your container class. With
- templates, you can program type-safe containers.
-